// pages/index/serve.js
const http = require('../../../utils/http.js'); //相对路径
Page({
  /**
   * 页面的初始数据
   */
  data: {
    show: true,
    CarinfoData: '',  //其他页面开单的数据
    toptitleshow: false, //顶部提示框
    currentWordNumber: 0,  //文本域的字符数
    workNumber: '',
    detailData: '',
    professionCate: '', //业务分类
    professionindex: 0, //业分类选择下标
    carCate: '', //车辆分类
    carCateindex: 0,
    provider: '', //供应商数据,
    itemMoild: true, //项目修改弹窗
    itemInfoData: '', //需要修改的项目
    modalShow: false, //选择项目弹窗
    projectList: '', //项目列表
    proData: '', //项目选择弹窗的底部数据
    modalShow1: false, //添加材料弹窗
    materialData: '', //添加材料弹窗的数据
    FRPMoild: true, //材料弹窗
    nmaeRes: '', //材料修改弹窗中的零时数据
    baseData: '', //技师数据
    technician: false, //选择技师弹窗
    jishiIndex: '', //需要修改的技师数据下标
    Picedata: '', //未确定的技师数据
    inputshow: true, //输入框切换
    professionindex1: 0, //服务顾问的下标
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    if(options.item) {
      let item = JSON.parse(options.item);
      if(!item.car_id){
        item.car_id  = item.id;
        item.brand_logo = item.brand.brandLogo;
        item.owner_name =  item.owner.name;
        item.mobile = item.owner.mobile;
        item.car_type = item.brand.name;
      }
      this.setData({
        CarinfoData: item
      })
    }
    this.initRes();
  },
  navbind(e) {
    let index = e.currentTarget.dataset.index;
    this.setData({
      navindex: index
    })
  },
  onPickerChange(e) {
    let detailData = this.data.detailData;
    detailData.enter_time = (new Date(e.detail.date).getTime()) / 1000;
    detailData.time1 = e.detail.dateString;
    this.setData({
      detailData: detailData
    })
  },
  onPickerChange1(e) {
    let detailData = this.data.detailData;
    detailData.exit_time = (new Date(e.detail.date).getTime()) / 1000;
    detailData.time2 = e.detail.dateString;
    this.setData({
      detailData: detailData
    })
  },
  //搜索车辆信息
  bindinput(e) { 
    if (e.detail.value == '') {
      this.setData({
        useliist: []
      })
    } else {
      http.postRequest('/mini/v1/car_owner/search', {
        per_page: 1000,
        page: 1,
        search: e.detail.value
      }, res => {
        this.setData({
          useliist: res.data
        })
      })
    }
  },
  // 将选择的车辆添加至页面
  usetap(e) {
    let item = e.currentTarget.dataset.item;
    let detailData = this.data.detailData;
    detailData.owner_id = item.owner_id;
    detailData.car = {};
    detailData.owner = {};
    detailData.car_id = item.car_id;
    detailData.car.brandLogo = item.brand_logo;
    detailData.car.car_prefix = item.car_prefix;
    detailData.car.car_number = item.car_number;
    detailData.owner.name = item.owner_name;
    detailData.owner.mobile = item.mobile;
    detailData.car.car_type = item.car_type;
    this.setData({
      detailData:detailData
    })
  },
  //选择车辆信息进行添加
  jumpNewUser() { //清除客户信息，重新获取文本框焦点
    let detailData = this.data.detailData;
    detailData.owner_id = '';
    detailData.car_id = '';
    this.setData({
      focus: true, //搜索框焦点
      inputshow: true,
      detailData: detailData
    })
  },
  // 行驶里程的数据双向绑定
  nowMileage(e) {
    let detailData = this.data.detailData;
    detailData.now_mileage = e.detail.value;
    this.setData({
      detailData: detailData
    })
  },
  //车辆分类
  bindPickerChange: function (e) {
    let detailData = this.data.detailData;
    detailData.car_category_id = this.data.carCate[e.detail.value].id;
    this.setData({
      carCateindex: e.detail.value,
      detailData: detailData
    })
  },
  //业务分类
  bindPickerChange1: function (e) {
    let detailData = this.data.detailData;
    detailData.profession_cate_id = this.data.professionCate[e.detail.value].id;
    this.setData({
      professionindex: e.detail.value,
      detailData: detailData
    })
  },
  //服务顾问
  bindPickerChange2: function (e) {
    let detailData = this.data.detailData;
    detailData.staff_id = this.data.baseData[e.detail.value].id;
    this.setData({
      professionindex1: e.detail.value,
      detailData: detailData
    })
  },
  //修改工单
  modify() {
    http.postRequest('/mini/v1/work/info', {
      shop_app_id: wx.getAccountInfoSync().miniProgram.appId,
      work_id: this.data.workId,
      work_number: this.data.workNumber
    }, res => {

    })
  },
  // 项目编辑弹窗
  itemMoildHide() {
    this.setData({
      itemMoild: true
    })
  },
  // 弹出某个项目进行修改
  itemMoildShow(e) {
    let detailData = this.data.detailData;
    e.currentTarget.dataset.item.discountPrice = detailData.work_invoices_project[e.currentTarget.dataset.index].hour * detailData.work_invoices_project[e.currentTarget.dataset.index].unit_price * detailData.work_invoices_project[e.currentTarget.dataset.index].discount;
    e.currentTarget.dataset.item.index = e.currentTarget.dataset.index;
    this.setData({
      itemMoild: false,
      itemInfoData: e.currentTarget.dataset.item
    })
  },
  // 工时单价输入框
  getInputPri(e) {
    let itemInfoData = this.data.itemInfoData;
    itemInfoData.unit_price = e.detail.value;
    itemInfoData.discountPrice = (e.detail.value * itemInfoData.hour * itemInfoData.discount).toFixed(2);
    this.setData({
      itemInfoData: itemInfoData
    })
  },
  // 工时输入框
  getInputTime(e) {
    let itemInfoData = this.data.itemInfoData;
    itemInfoData.hour = e.detail.value;
    itemInfoData.discountPrice = (e.detail.value * itemInfoData.unit_price * itemInfoData.discount).toFixed(2);
    this.setData({
      itemInfoData: itemInfoData
    })
  },
  // 项目折扣输入框
  getInputDis(e) {
    let itemInfoData = this.data.itemInfoData;
    if (e.detail.value > 1) {
      itemInfoData.discount = 1;
      itemInfoData.discountPrice = (1 * itemInfoData.unit_price * itemInfoData.hour).toFixed(2);
    } else {
      itemInfoData.discount = e.detail.value;
      itemInfoData.discountPrice = (e.detail.value * itemInfoData.unit_price * itemInfoData.hour).toFixed(2);
    }
    this.setData({
      itemInfoData: itemInfoData
    })
  },
  // 输入项目备注
  setremark(e) {
    let itemInfoData = this.data.itemInfoData;
    itemInfoData.remark = e.detail.value;
    this.setData({
      itemInfoData: itemInfoData
    })
  },
  // 弹出添加项目弹窗
  showModal() {
    http.postRequest('/mini/v1/project/list', {}, res => {
      res.data.pagenum = 1;
      res.data.total = 0;
      res.data.numnap = 0;
      this.setData({
        projectList: res.data
      })
    })
    this.setData({
      modalShow: true
    })
  },
  // 弹出服务技师选择弹窗
  sershow(e) {
    let detailData = this.data.detailData;
    this.data.Picedata = JSON.parse(JSON.stringify(detailData.work_invoices_project[e.currentTarget.dataset.index]));
    detailData.work_invoices_project[e.currentTarget.dataset.index].selectChek = 0;
    for (let i in detailData.work_invoices_project[e.currentTarget.dataset.index].jishiArr) {
      if (detailData.work_invoices_project[e.currentTarget.dataset.index].jishiArr[i].check) {
        detailData.work_invoices_project[e.currentTarget.dataset.index].selectChek++;
      }
    }
    this.setData({
      technician: true,
      detailData: detailData,
      jishiIndex: e.currentTarget.dataset.index
    })
  },
  // 技师的选中
  jishicheckbox(e) {
    let detailData = this.data.detailData;
    detailData.work_invoices_project[this.data.jishiIndex].jishiArr[e.currentTarget.dataset.index].check = !this.data.detailData.work_invoices_project[this.data.jishiIndex].jishiArr[e.currentTarget.dataset.index].check;
    if (detailData.work_invoices_project[this.data.jishiIndex].jishiArr[e.currentTarget.dataset.index].check) {
      detailData.work_invoices_project[this.data.jishiIndex].selectChek++;
    } else {
      detailData.work_invoices_project[this.data.jishiIndex].selectChek--;
    }
    this.setData({
      detailData: detailData
    })
  },
  // 关闭添加项目弹窗
  cancelTeam() {
    this.setData({
      modalShow: false
    })
  },
  // 选择项目时的查询
  searchInput(e) {
    http.postRequest('/mini/v1/project/list', {
      search: e.detail.value
    }, res => {
      res.data.pagenum = 1;
      res.data.total = 0;
      res.data.numnap = 0;
      this.setData({
        projectList: res.data
      })
    })
  },
  // 选择项目列表滚动到底部加载
  teamLower() {
    let projectList = this.data.projectList;
    projectList.pagenum++;
    if (projectList.pagenum <= projectList.last_page) {
      http.postRequest('/mini/v1/project/list', {
        page: projectList.pagenum
      }, res => {
        for (let i in res.data.data) {
          projectList.data.push(res.data.data[i]);
        }
        this.setData({
          projectList: projectList
        })
      })
    }
  },
  // 项目的选中事件
  itemcheckbox(e) {
    let projectList = this.data.projectList;
    if (projectList.data[e.currentTarget.dataset.index].check) {
      projectList.data[e.currentTarget.dataset.index].check = false;
      projectList.total -= Number(projectList.data[e.currentTarget.dataset.index].fee);
      projectList.numnap--;
    } else {
      projectList.data[e.currentTarget.dataset.index].check = true;
      projectList.total += Number(projectList.data[e.currentTarget.dataset.index].fee);
      projectList.numnap++;
    }
    this.setData({
      projectList: projectList
    })
  },
  // 添加项目弹窗的确定
  probtn() {
    let projectList = this.data.projectList;
    let detailData = this.data.detailData;
    for (let i in projectList.data) {
      if (projectList.data[i].check) {
        if (!(projectList.data[i].discount)) projectList.data[i].discount = 1;
        projectList.data[i].project_id = projectList.data[i].id;
        projectList.data[i].jishiArr = JSON.parse(JSON.stringify(this.data.baseData));
        detailData.work_invoices_project.push(projectList.data[i]);
      }
    }
    detailData.receivable_amount = (Number(detailData.receivable_amount) + Number(projectList.total)).toFixed(2);
    detailData.project_real_amount = (Number(detailData.project_real_amount) + Number(projectList.total)).toFixed(2);
    detailData.real_amount = (Number(detailData.real_amount) + Number(projectList.total)).toFixed(2);
    detailData.project_receivable_amount = (Number(detailData.project_receivable_amount) + Number(projectList.total)).toFixed(2);
    this.setData({
      detailData: detailData,
      modalShow: false
    })
  },
  // 关闭服务技师
  fuwuhide() {
    let detailData = this.data.detailData;
    detailData.work_invoices_project[this.data.jishiIndex] = this.data.Picedata;
    this.setData({
      detailData: detailData,
      technician: false
    })
  },
  // 确定选择技师
  jishiOk() {
    let detailData = this.data.detailData;
    detailData.work_invoices_project[this.data.jishiIndex].technician_ids = [];
    for (let i in detailData.work_invoices_project[this.data.jishiIndex].jishiArr) {
      if (detailData.work_invoices_project[this.data.jishiIndex].jishiArr[i].check) {
        detailData.work_invoices_project[this.data.jishiIndex].technician_ids.push(detailData.work_invoices_project[this.data.jishiIndex].jishiArr[i].id);
      }
    }
    this.setData({
      detailData: detailData,
      technician: false
    })
  },
  // 修改项目
  itemalter() {
    let num = 0;
    let itemInfoData = this.data.itemInfoData;
    let detailData = this.data.detailData;
    num = (detailData.work_invoices_project[itemInfoData.index].discount * detailData.work_invoices_project[itemInfoData.index].hour * detailData.work_invoices_project[itemInfoData.index].unit_price - itemInfoData.unit_price * itemInfoData.hour * itemInfoData.discount).toFixed(2);
    detailData.project_receivable_amount = (Number(detailData.project_receivable_amount)-(detailData.work_invoices_project[itemInfoData.index].hour * detailData.work_invoices_project[itemInfoData.index].unit_price - itemInfoData.unit_price * itemInfoData.hour)).toFixed(2);
    detailData.project_real_amount = (Number(detailData.project_real_amount)-(detailData.work_invoices_project[itemInfoData.index].discount * detailData.work_invoices_project[itemInfoData.index].hour * detailData.work_invoices_project[itemInfoData.index].unit_price - itemInfoData.unit_price * itemInfoData.hour * itemInfoData.discount)).toFixed(2)

    detailData.real_amount = Number(detailData.real_amount) - num;
    detailData.receivable_amount = (Number(detailData.receivable_amount) - (1 * detailData.work_invoices_project[itemInfoData.index].hour * detailData.work_invoices_project[itemInfoData.index].unit_price - itemInfoData.unit_price * itemInfoData.hour * 1)).toFixed(2);
    detailData.work_invoices_project[itemInfoData.index].remark = itemInfoData.remark;
    detailData.work_invoices_project[itemInfoData.index].hour = itemInfoData.hour;
    detailData.work_invoices_project[itemInfoData.index].unit_price = itemInfoData.unit_price;
    detailData.work_invoices_project[itemInfoData.index].discount = itemInfoData.discount;
    this.setData({
      detailData: detailData,
      itemMoild: true
    })
  },
  // 删除已选择的项目
  deleTeam(e) {
    let detailData = this.data.detailData;
    detailData.real_amount = Number(detailData.real_amount) - detailData.work_invoices_project[e.currentTarget.dataset.index].hour * detailData.work_invoices_project[e.currentTarget.dataset.index].unit_price * detailData.work_invoices_project[e.currentTarget.dataset.index].discount;
    detailData.project_receivable_amount = Number(detailData.project_receivable_amount) - detailData.work_invoices_project[e.currentTarget.dataset.index].hour * detailData.work_invoices_project[e.currentTarget.dataset.index].unit_price * 1
    detailData.project_real_amount -= Number(detailData.work_invoices_project[e.currentTarget.dataset.index].hour) * Number(detailData.work_invoices_project[e.currentTarget.dataset.index].unit_price) * Number(detailData.work_invoices_project[e.currentTarget.dataset.index].discount);
    detailData.receivable_amount = Number(detailData.receivable_amount) - detailData.work_invoices_project[e.currentTarget.dataset.index].hour * detailData.work_invoices_project[e.currentTarget.dataset.index].unit_price * 1;
    detailData.work_invoices_project.splice(e.currentTarget.dataset.index, 1);
    this.setData({
      detailData: detailData
    })
  },
  // 弹出材料选择弹窗
  showModal1() {
    this.setData({
      modalShow1: true
    })
    http.postRequest('/mini/v1/material/list', {}, res => {
      res.data.pagenum = 1;
      res.data.total = 0;
      res.data.numnap = 0;
      for (let i in res.data.data) {
        res.data.data[i].number = 1
      }
      this.setData({
        materialData: res.data
      })
    })
  },
  // 关闭材料选择弹窗
  cancelTeam1() {
    this.setData({
      modalShow1: false
    })
  },
  // 查询材料
  searchInput1(e) {
    http.postRequest('/mini/v1/material/list', {
      search: e.detail.value
    }, res => {
      let materialData = this.data.materialData;
      materialData.data = res.data.data;
      this.setData({
        materialData: materialData
      })
    })
  },
  // 材料滚动加载
  teamLower1() {
    let materialData = this.data.materialData;
    materialData.pagenum++;
    if (materialData.pagenum <= materialData.last_page) {
      http.postRequest('/mini/v1/project/list', {
        page: materialData.pagenum
      }, res => {
        for (let i in res.data.data) {
          materialData.data.push(res.data.data[i]);
        }
        this.setData({
          materialData: materialData
        })
      })
    }
  },
  // 材料的勾选
  itemcheckbox1(e) {
    let materialData = this.data.materialData;
    if (materialData.data[e.currentTarget.dataset.index].check) {
      materialData.data[e.currentTarget.dataset.index].check = false;
      materialData.total -= Number(materialData.data[e.currentTarget.dataset.index].sell_price);
      materialData.numnap--;
    } else {
      materialData.data[e.currentTarget.dataset.index].check = true;
      materialData.total += Number(materialData.data[e.currentTarget.dataset.index].sell_price);
      materialData.numnap++;
    }
    this.setData({
      materialData: materialData
    })
  },
  // 将选中的材料数据添加到工单中
  probtn1() {
    let materialData = this.data.materialData;
    let detailData = this.data.detailData;
    for (let i in materialData.data) {
      if (materialData.data[i].check) {
        if (!(materialData.data[i].discount)) materialData.data[i].discount = 1;
        materialData.data[i].number = 1;
        materialData.data[i].material = {};
        materialData.data[i].material_id = materialData.data[i].id;
        materialData.data[i].material.name = materialData.data[i].name;
        materialData.data[i].unit_price = materialData.data[i].sell_price;
        if (!(detailData.work_invoices_material)) detailData.work_invoices_material = [];
        detailData.work_invoices_material.push(materialData.data[i]);
      }
    }
    detailData.receivable_amount = (Number(detailData.receivable_amount) + Number(materialData.total)).toFixed(2);
    detailData.real_amount = (Number(detailData.real_amount) + Number(materialData.total)).toFixed(2);
    detailData.material_receivable_amount = (Number(detailData.material_receivable_amount) + Number(materialData.total)).toFixed(2);
    detailData.material_real_amount = (Number(detailData.material_real_amount) + Number(materialData.total)).toFixed(2);
    this.setData({
      detailData: detailData,
      modalShow1: false
    })
  },
  // 修改已选中的材料
  xiumate(e) {
    let detailData = this.data.detailData;
    let nmaeRes = JSON.parse(JSON.stringify(detailData.work_invoices_material[e.currentTarget.dataset.index]));
    nmaeRes.index = e.currentTarget.dataset.index;
    nmaeRes.discountPrice = (Number(nmaeRes.unit_price) * Number(nmaeRes.number) * Number(nmaeRes.discount)).toFixed(2);
    this.setData({
      nmaeRes: nmaeRes,
      FRPMoild: false
    })
  },
  // 材料单价更改时
  getInputPri1(e) {
    let nmaeRes = this.data.nmaeRes;
    nmaeRes.unit_price = e.detail.value;
    nmaeRes.discountPrice = Number(e.detail.value) * Number(nmaeRes.number) * Number(nmaeRes.discount);
    this.setData({
      nmaeRes: nmaeRes
    })
  },
  // 材料数量更改时
  getInputTime1(e) {
    let nmaeRes = this.data.nmaeRes;
    nmaeRes.number = e.detail.value;
    nmaeRes.discountPrice = Number(nmaeRes.unit_price) * Number(e.detail.value) * Number(nmaeRes.discount);
    this.setData({
      nmaeRes: nmaeRes
    })
  },
  // 材料折扣更改时
  getInputDis1(e) {
    let nmaeRes = this.data.nmaeRes;
    nmaeRes.discount = e.detail.value;
    if (nmaeRes.discount > 1) {
      nmaeRes.discount = 1;
      nmaeRes.discountPrice = Number(nmaeRes.unit_price) * Number(nmaeRes.number) * 1;
    } else {
      nmaeRes.discount = e.detail.value;
      nmaeRes.discountPrice = Number(nmaeRes.unit_price) * Number(nmaeRes.number) * Number(e.detail.value);
    }
    this.setData({
      nmaeRes: nmaeRes
    })
  },
  // 修改材料备注
  Setremark1(e) {
    let nmaeRes = this.data.nmaeRes;
    nmaeRes.remark = e.detail.value;
    this.setData({
      nmaeRes: nmaeRes
    })
  },
  // 确定已修改的材料数据
  itemalter1() {
    let nmaeRes = this.data.nmaeRes;
    let detailData = this.data.detailData;
    let num = Number(detailData.work_invoices_material[nmaeRes.index].discount) * Number(detailData.work_invoices_material[nmaeRes.index].number) * Number(detailData.work_invoices_material[nmaeRes.index].unit_price) - Number(nmaeRes.unit_price) * Number(nmaeRes.number) * Number(nmaeRes.discount);
    let num1 = (1 * Number(detailData.work_invoices_material[nmaeRes.index].number) * Number(detailData.work_invoices_material[nmaeRes.index].unit_price) - Number(nmaeRes.unit_price) * Number(nmaeRes.number) * 1);
    detailData.real_amount = Number(detailData.real_amount) - num;
    detailData.receivable_amount = Number(detailData.receivable_amount) - num1;
    detailData.work_invoices_material[nmaeRes.index].remark = nmaeRes.remark;
    detailData.work_invoices_material[nmaeRes.index].number = nmaeRes.number;
    detailData.work_invoices_material[nmaeRes.index].unit_price = nmaeRes.unit_price;
    detailData.work_invoices_material[nmaeRes.index].discount = nmaeRes.discount;
    detailData.material_receivable_amount = Number(detailData.material_receivable_amount) - num1;
    detailData.material_real_amount = Number(detailData.material_real_amount) - num;
    this.setData({
      detailData: detailData,
      FRPMoild: true
    })
  },
  // 关闭材料修改弹窗
  itemMoildHide1() {
    this.setData({
      FRPMoild: true
    })
  },
  // 删除已选择的材料
  deleTeam1(e) {
    let detailData = this.data.detailData;
    detailData.material_receivable_amount = Number(detailData.material_receivable_amount) - detailData.work_invoices_material[e.currentTarget.dataset.index].number * detailData.work_invoices_material[e.currentTarget.dataset.index].unit_price * 1
    detailData.material_real_amount = Number(detailData.material_real_amount) - detailData.work_invoices_material[e.currentTarget.dataset.index].number * detailData.work_invoices_material[e.currentTarget.dataset.index].unit_price * detailData.work_invoices_material[e.currentTarget.dataset.index].discount;
    detailData.real_amount = Number(detailData.real_amount) - detailData.work_invoices_material[e.currentTarget.dataset.index].number * detailData.work_invoices_material[e.currentTarget.dataset.index].unit_price * detailData.work_invoices_material[e.currentTarget.dataset.index].discount;
    detailData.receivable_amount = Number(detailData.receivable_amount) - detailData.work_invoices_material[e.currentTarget.dataset.index].number * detailData.work_invoices_material[e.currentTarget.dataset.index].unit_price * 1;
    detailData.work_invoices_material.splice(e.currentTarget.dataset.index, 1);
    this.setData({
      detailData: detailData
    })
  },
  // 文本域限制
  inputs(e) {
    var value = e.detail.value;
    let detailData = this.data.detailData;
    detailData.remark = e.detail.value;
    var len = parseInt(value.length);
    if(len > 80) return;
    this.setData({
      currentWordNumber: len,
      detailData: detailData
    })
  },  
  // 提交页面数据
  submit() {
    let from = JSON.parse(JSON.stringify(this.data.detailData));
    if(from.owner_id && from.car_id) {
      from.enter_time = Math.round(new Date(from.enter_time).getTime()/1000);
      from.exit_time = Math.round(new Date(from.exit_time).getTime()/1000);
      from.project_info = from.work_invoices_project;
      from.material_info = from.work_invoices_material;
      delete from.work_invoices_material;
      delete from.work_invoices_project;
      http.postRequest('/mini/v1/work/add', from, res=> {
        if(res.code == 0) {
          wx.navigateBack({
            delta: 1
          })
        }
      })
    } else {
      this.setData({
        toptitleshow: true
      })
      setTimeout(()=>{
        this.setData({
          toptitleshow: false
        })
      },2000)
    }
  },
  // 初始化页面数据
  initRes(item) {
    let detailData = {};
    detailData.work_invoices_project = [];
    detailData.work_invoices_material = [];
    let time = new Date();
    detailData.time1 = http.transTime(new Date().getTime()/1000);;
    detailData.time2 = http.transTime(new Date().getTime()/1000 + 3600);;
    detailData.enter_time = time;
    detailData.exit_time = time;
    detailData.project_real_amount = 0;
    detailData.project_receivable_amount = 0;
    detailData.material_receivable_amount = 0;
    detailData.material_real_amount = 0;
    detailData.receivable_amount = 0;
    detailData.real_amount = 0;
    http.postRequest('/mini/v1/work/base_data',{},res=>{
      detailData.staff_id = res.data.staff_data[0].id;
      detailData.profession_cate_id = res.data.profession_cate[0].id;
      detailData.car_category_id = res.data.car_cate[0].id;
      if(this.data.CarinfoData) { 
        let item = this.data.CarinfoData;
        detailData.owner_id = item.owner_id;
        detailData.car = {};
        detailData.owner = {};
        detailData.car_id = item.car_id;
        detailData.car.brandLogo = item.brand_logo;
        detailData.car.car_prefix = item.car_prefix;
        detailData.car.car_number = item.car_number;
        detailData.owner.name = item.owner_name;
        detailData.owner.mobile = item.mobile;
        detailData.car.car_type = item.car_type;
      }
      this.setData({
        detailData: detailData,
        baseData: res.data.staff_data,
        professionCate: res.data.profession_cate,
        carCate: res.data.car_cate
      })
    })
  },
  show() {
    this.setData({
      show: false
    })
  },
  hide() {
    this.setData({
      show: true
    })
  }
})